package com.sxz.sbs.module.client.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sxz.sbs.R;
import com.sxz.sbs.app.GlideApp;
import com.sxz.sbs.module.client.bean.AllHousesBean;
import com.sxz.sbs.module.client.bean.StartBean;

import java.util.List;

/**
 * 星级适配器
 */

public class StartAdapter extends BaseQuickAdapter<StartBean,BaseViewHolder>{

    private int defaultSelection = -1;

    public StartAdapter(@Nullable List<StartBean> data) {
        super(R.layout.item_start,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, StartBean item) {
        helper.setText(R.id.tv_start,item.getStartName());  //rela_start
        if (defaultSelection == helper.getAdapterPosition()) {// 选中时设置单纯颜色
            helper.setTextColor(R.id.tv_start,mContext.getResources().getColor(R.color.color_white));
            helper.setBackgroundRes(R.id.tv_start,R.drawable.colormain_btn_bg);  //
        } else {// 未选中时设置selector
            helper.setTextColor(R.id.tv_start,mContext.getResources().getColor(R.color.color_text_9));
            helper.setBackgroundRes(R.id.tv_start,R.drawable.colorhui_btn_bg);  //
        }
    }

    public void setSelectPosition(int i) {
        this.defaultSelection = i;
        notifyDataSetChanged();
    }
}
